package springtest.test;

import com.license4j.License;
import com.license4j.LicenseValidator;

/**
 * @author chenzhiqiang
 * @date 2018-02-24 16:19:45
 */

public class test1 {
    public static void main(String[] args) {

        String key = "ZRV2E-NRUW9-AI6U2-GNZHE-B4DJP";

        String publickey = "30819f300d06092a864886f70d010101050003818d003081893032301006072a8648ce3d02002EC311215SHA512withECDSA106052b81040006031e000417f25a60ed36355f0fe4f23562b752ea9c577c8cb26671a86008d745G02818100f831dbf9ead328d29c70afa8df7a0cdd31f3d8066248cfdeea630042c781b141f4d68861c7062dde09e439573c73c31305104f0823dcc73bf3116ed2daedf337c81a4799f562b8b280239d3bd0e9e274ffe79bccb0c7a0466392a745da57569203RSA4102413SHA512withRSA3f0a9f0f64f681c94c6e3141ae2815ce18f4941f0db53d9240605739d3cd51850203010001";

        String internalString = "test";
        String nameforValidation = "test";
        String companyforValidation = "test";
        int hardwareIDMethod = 2;

        License license = LicenseValidator.validate(key, publickey, internalString, nameforValidation,
                companyforValidation, hardwareIDMethod);
        System.out.println("Validating with all correct parameters: " + license.getValidationStatus());

        license = LicenseValidator.validate(key, publickey, "incorrect-internal", nameforValidation,
                companyforValidation, hardwareIDMethod);
        System.out.println(
                "Validating with incorrect internal string ('incorrect-internal'): " + license.getValidationStatus());

        license = LicenseValidator.validate(key, publickey, internalString, "incorrect-name", companyforValidation,
                hardwareIDMethod);
        System.out.println("Validating with incorrect name ('incorrect-name'): " + license.getValidationStatus());

        license = LicenseValidator.validate(key, publickey, internalString, nameforValidation, "incorrect-company",
                hardwareIDMethod);
        System.out.println(
                "Validating with incorrect company name ('incorrect-company'): " + license.getValidationStatus());

        license = LicenseValidator.validate(key, publickey, internalString, nameforValidation, companyforValidation,
                hardwareIDMethod);
        System.out.println("Validating with obtained local computer hardware id: " + license.getValidationStatus());

        license = LicenseValidator.validate(key, publickey, internalString, nameforValidation, companyforValidation,
                hardwareIDMethod);
        System.out.println("License Validation Status before activation: " + license.getValidationStatus());

    }
}
